package com.leenmvc.core.security.entity.core;

import com.leenmvc.core.annotation.DbInfo;
import com.leenmvc.core.annotation.FillField;
import com.leenmvc.core.annotation.PrimaryKey;
import com.leenmvc.core.annotation.TableField;
import com.leenmvc.core.annotation.validator.groups.AddGroup;
import com.leenmvc.core.annotation.validator.groups.UpdateGroup;
import com.leenmvc.core.utils.collection.TreeNode;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 部门管理
 *
 * @author leen
 */
@DbInfo(value = "sys_dept", comment = "部门")
public class SysDept extends TreeNode implements Serializable {

    @PrimaryKey
    @NotNull(message = "id不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Range(message = "长度过长", groups = {AddGroup.class, UpdateGroup.class})
    private Long id;

    /**
     * 上级ID
     */
    @NotNull(message = "上级部门不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Range(message = "长度过长", groups = {AddGroup.class, UpdateGroup.class})
    private Long pid;
    /**
     * 所有上级ID，用逗号分开
     */
    private String pids;
    /**
     * 部门名称
     */
    private String name;
    /**
     * 用户唯一标识
     */
    private String customerKey;

    /**
     * 南北区标志 1南区2北区
     */
    private Integer nsSign;

    /**
     * 排序
     */
    private Integer sort;
    /**
     * 创建人
     */
    private Long creator;
    /**
     * 创建时间
     */
    private Date createDate;
    /**
     * 更新者
     */
    private Long updater;
    /**
     * 更新时间
     */
    private Date updateDate;
    /**
     * 上级部门名称
     */
    @FillField(entity = SysDept.class, outField = "name", inField = "pid")
    @Length(min = 1, max = 100, groups = {AddGroup.class, UpdateGroup.class})
    @TableField(false)
    private String parentName;

    /**
     * 该菜单的顶级Id
     */
    @TableField(false)
    private Long topId;

//    /**
//     * 工号
//     */
//    private Long workshopNumber;

    /**
     * 部门人数
     */
    private Long deptPopulation;

    /**
     * 部门负责人
     */
    private String charger;

//    /**
//     * 部门负责人
//     */
//    @FillField(type = FillType.ONE_FIELD_IN ,entity = SysUser.class, outField = "username", inField = "chargerId", defaultQueryIt = true)
//    @TableField(false)
//    private String chargerName;

    /**
     * 联系电话
     */
    private Long phone;

    public Integer getNsSign() {
        return nsSign;
    }

    public void setNsSign(Integer nsSign) {
        this.nsSign = nsSign;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }

    public String getPids() {
        return pids;
    }

    public void setPids(String pids) {
        this.pids = pids;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCustomerKey() {
        return customerKey;
    }

    public void setCustomerKey(String customerKey) {
        this.customerKey = customerKey;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Long getUpdater() {
        return updater;
    }

    public void setUpdater(Long updater) {
        this.updater = updater;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    public void setCreator(Long creator) {
        this.creator = creator;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Long getCreator() {
        return creator;
    }

    public Long getTopId() {
        return topId;
    }

    public void setTopId(Long topId) {
        this.topId = topId;
    }

//    public Long getWorkshopNumber() {
//        return workshopNumber;
//    }
//
//    public void setWorkshopNumber(Long workshopNumber) {
//        this.workshopNumber = workshopNumber;
//    }

    public Long getDeptPopulation() {
        return deptPopulation;
    }

    public void setDeptPopulation(Long deptPopulation) {
        this.deptPopulation = deptPopulation;
    }

    public String getCharger() {
        return charger;
    }

    public void setCharger(String charger) {
        this.charger = charger;
    }

    public Long getPhone() {
        return phone;
    }

    public void setPhone(Long phone) {
        this.phone = phone;
    }
}
